﻿using System;
using System.Data;
using System.Data.Common;
using Hxj.Data;
using Hxj.Data.Common;

namespace Utility.Model
{
    /// <summary>
    /// 部门实体
    /// </summary>
    [Serializable]
    public class Sys_Dept : Entity
    {
        /// <summary>
        /// 部门实体
        /// </summary>
        public Sys_Dept()
            : base("Sys_Dept")
        {
            this._ID = Guid.NewGuid().ToString();
            this._CreateDate = ConvertHelper.GetNowDateTime();
            this._IsDelete = false;
        }

        #region Model
        private string _ID;
        private string _DeptName;
        private string _DeptCode;
        private string _DeptID;
        private string _ParentID;
        private int? _Sort;
        private bool? _IsDelete;
        private DateTime? _CreateDate;
        private string _CreateUser;
        /// <summary>
        /// 
        /// </summary>
        public string ID
        {
            get { return _ID; }
            set
            {
                this.OnPropertyValueChange(_.ID, _ID, value);
                this._ID = value;
            }
        }
        /// <summary>
        /// 部门名称
        /// </summary>
        public string DeptName
        {
            get { return _DeptName; }
            set
            {
                this.OnPropertyValueChange(_.DeptName, _DeptName, value);
                this._DeptName = value;
            }
        }
        /// <summary>
        /// 部门Code
        /// </summary>
        public string DeptCode
        {
            get { return _DeptCode; }
            set
            {
                this.OnPropertyValueChange(_.DeptCode, _DeptCode, value);
                this._DeptCode = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public string DeptID
        {
            get { return _DeptID; }
            set
            {
                this.OnPropertyValueChange(_.DeptID, _DeptID, value);
                this._DeptID = value;
            }
        }
        /// <summary>
        /// 上级部门ID
        /// </summary>
        public string ParentID
        {
            get { return _ParentID; }
            set
            {
                this.OnPropertyValueChange(_.ParentID, _ParentID, value);
                this._ParentID = value;
            }
        }
        /// <summary>
        /// 排序号
        /// </summary>
        public int? Sort
        {
            get { return _Sort; }
            set
            {
                this.OnPropertyValueChange(_.Sort, _Sort, value);
                this._Sort = value;
            }
        }
        /// <summary>
        /// 是否删除
        /// </summary>
        public bool? IsDelete
        {
            get { return _IsDelete; }
            set
            {
                this.OnPropertyValueChange(_.IsDelete, _IsDelete, value);
                this._IsDelete = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? CreateDate
        {
            get { return _CreateDate; }
            set
            {
                this.OnPropertyValueChange(_.CreateDate, _CreateDate, value);
                this._CreateDate = value;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public string CreateUser
        {
            get { return _CreateUser; }
            set
            {
                this.OnPropertyValueChange(_.CreateUser, _CreateUser, value);
                this._CreateUser = value;
            }
        }
        #endregion

        #region Method
        /// <summary>
        /// 获取实体中的主键列
        /// </summary>
        public override Field[] GetPrimaryKeyFields()
        {
            return new Field[] {
				_.ID};
        }
        /// <summary>
        /// 获取列信息
        /// </summary>
        public override Field[] GetFields()
        {
            return new Field[] {
				_.ID,
				_.DeptName,
				_.DeptCode,
				_.DeptID,
				_.ParentID,
				_.Sort,
				_.IsDelete,
				_.CreateDate,
				_.CreateUser};
        }
        /// <summary>
        /// 获取值信息
        /// </summary>
        public override object[] GetValues()
        {
            return new object[] {
				this._ID,
				this._DeptName,
				this._DeptCode,
				this._DeptID,
				this._ParentID,
				this._Sort,
				this._IsDelete,
				this._CreateDate,
				this._CreateUser};
        }
        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        public override void SetPropertyValues(IDataReader reader)
        {
            this._ID = DataUtils.ConvertValue<string>(reader["ID"]);
            this._DeptName = DataUtils.ConvertValue<string>(reader["DeptName"]);
            this._DeptCode = DataUtils.ConvertValue<string>(reader["DeptCode"]);
            this._DeptID = DataUtils.ConvertValue<string>(reader["DeptID"]);
            this._ParentID = DataUtils.ConvertValue<string>(reader["ParentID"]);
            this._Sort = DataUtils.ConvertValue<int?>(reader["Sort"]);
            this._IsDelete = DataUtils.ConvertValue<bool?>(reader["IsDelete"]);
            this._CreateDate = DataUtils.ConvertValue<DateTime?>(reader["CreateDate"]);
            this._CreateUser = DataUtils.ConvertValue<string>(reader["CreateUser"]);
        }
        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        public override void SetPropertyValues(DataRow row)
        {
            this._ID = DataUtils.ConvertValue<string>(row["ID"]);
            this._DeptName = DataUtils.ConvertValue<string>(row["DeptName"]);
            this._DeptCode = DataUtils.ConvertValue<string>(row["DeptCode"]);
            this._DeptID = DataUtils.ConvertValue<string>(row["DeptID"]);
            this._ParentID = DataUtils.ConvertValue<string>(row["ParentID"]);
            this._Sort = DataUtils.ConvertValue<int?>(row["Sort"]);
            this._IsDelete = DataUtils.ConvertValue<bool?>(row["IsDelete"]);
            this._CreateDate = DataUtils.ConvertValue<DateTime?>(row["CreateDate"]);
            this._CreateUser = DataUtils.ConvertValue<string>(row["CreateUser"]);
        }
        #endregion

        #region _Field
        /// <summary>
        /// 字段信息
        /// </summary>
        public class _
        {
            /// <summary>
            /// * 
            /// </summary>
            public readonly static Field All = new Field("*", "Sys_Dept");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field ID = new Field("ID", "Sys_Dept", "ID");
            /// <summary>
            /// 部门名称
            /// </summary>
            public readonly static Field DeptName = new Field("DeptName", "Sys_Dept", "部门名称");
            /// <summary>
            /// 部门Code
            /// </summary>
            public readonly static Field DeptCode = new Field("DeptCode", "Sys_Dept", "部门Code");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field DeptID = new Field("DeptID", "Sys_Dept", "DeptID");
            /// <summary>
            /// 上级部门ID
            /// </summary>
            public readonly static Field ParentID = new Field("ParentID", "Sys_Dept", "上级部门ID");
            /// <summary>
            /// 排序号
            /// </summary>
            public readonly static Field Sort = new Field("Sort", "Sys_Dept", "排序号");
            /// <summary>
            /// 是否删除
            /// </summary>
            public readonly static Field IsDelete = new Field("IsDelete", "Sys_Dept", "是否删除");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field CreateDate = new Field("CreateDate", "Sys_Dept", "CreateDate");
            /// <summary>
            /// 
            /// </summary>
            public readonly static Field CreateUser = new Field("CreateUser", "Sys_Dept", "CreateUser");
        }
        #endregion


    }
}

